/**
 * @description Jwt的颁发予校验
 * @author 盘古他爹
 */

const Jwt = require("jsonwebtoken")
import { IUserInfo } from "../service/user/types"
const secret = "lanshi"

//添加token
export function JwtSign(userInfo: IUserInfo) {

    var token = Jwt.sign(userInfo, secret);

    return token
}

//验证token
export function JwtVerify(token: string) {
    console.log("验证", Jwt.verify(token, secret));
    return Jwt.verify(token, secret);

}
